package cn.taqu.dsl.activity

import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import cn.taqu.dsl.layout.SecondActivityDslLayout

/**
 * dsl 写布局
 * @author  HB.zyy
 * @date  2022-05-28
 */
class SecondActivity : AppCompatActivity() {

    /** 布局dsl 等价于 viewBinding文件 */
    private val contentViewDsl by lazy { SecondActivityDslLayout().inflate(this) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val beforeMills = System.currentTimeMillis()
        setContentView(contentViewDsl.getRoot())
        val totalMills = System.currentTimeMillis() - beforeMills

        Log.d(this.javaClass.simpleName, "================= 页面构建耗时：${totalMills}ms")
        // 类似ViewBinding使用控件
        contentViewDsl.tvTitle.text = "dsl耗时：${totalMills}ms"
    }

}